package com.aaa.sb.controller;

import com.aaa.sb.entity.Emp;
import com.aaa.sb.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * className:EmpController
 * discription:
 * author:luRuiHua
 * createTime:2018-11-23 11:38
 */
@Controller
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpService empService;

    /**
     * 调用存储过程
     * @return
     */
    @ResponseBody
    @RequestMapping("/proList")
    public Object proList(Integer deptNo) {
        System.out.println("deptNo:"+deptNo);
        Map map = new HashMap();
        map.put("deptNo",deptNo);
        System.out.println("map:"+map);
        List<Emp> listByPro = empService.getListByPro(map);
        System.out.println("list:"+listByPro);
        return listByPro;
    }
    /**
     * 跳转页面
     */
    @RequestMapping("/toList")
    public String toList(){
        return "empList";
    }
}
